// config/redis/redis.config.ts
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class RedisConfig {
  constructor(private configService: ConfigService) {}

  getRedisConfig(): {
    config: {
      host: string;
      port: number;
      password: string | null;
      db: number;
    };
  } {
    return {
      config: {
        host: this.configService.get<string>('redis.host') || 'localhost',
        port: this.configService.get<number>('redis.port') || 6379,
        password: this.configService.get<string>('redis.password') || null,
        db: this.configService.get<number>('redis.db') || 0,
      },
    };
  }
}
